<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- JSON字符串转js对象，js对象转JSON字符串。 -->
    <script>
      let json = '{ "name":"李四","age":19 }'
      //调用parse()转换为js对象
      let obj = JSON.parse(json)
      console.log(obj)

      let obj2 = { name: '张三', age: 20 }
      //调用stringify()转换为json
      let json2 = JSON.stringify(obj)
      console.log(json2)
    </script>
  </body>
</html>
